import os
import simplejson
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
from model import *
from handler import *

def main():
    mainapp = webapp.WSGIApplication([
            ('/', RootHandler),
            ('/feed', FeedHandler),
            ('/feed/locations', LocationsHandler),
            ('/feed/items', ItemsHandler),
            ('/feed/prices', PricesFeedHandler),
            ('/prices', PricesHandler)],
        debug=True)

    usa = Location.create(None, 'USA', 'USD')
    canada = Location.create(None, 'Canada', 'CAD')
    france = Location.create(None, 'France', 'Euro')
    china = Location.create(None, 'China', 'RMB')

    bigmac = Item.create("1 Big Mac")
    banana = Item.create("1 kg of Banana")
    toiletpaper = Item.create("1 Roll of Toilet Paper")
    bread = Item.create("1 Loaf of bread")

    Price.create(usa, bigmac, 2630)
    Price.create(canada, bigmac, 2410)
    Price.create(france, bigmac, 2650)
    Price.create(china, bigmac, 1270)

    util.run_wsgi_app(mainapp)

if __name__ == '__main__':
    main()
